<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        .basic{
            width: 100px;
            height: 100px;
            border: 1px solid pink;
        }
        .happy {
            background-color: skyblue;
        }
        .sad {
            background-color: palegreen;
        }
        .normal {
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div id="root">
        <div class="basic" :class='mood' @click="changeMood">{{name}}</div><br>
        <div class="basic" :class="classArr[1]">{{name}}</div><br>
        <div class="basic" :class="classObj" :style="styleObj">{{name}}</div>


    </div>

    <script>
        new Vue({
            el:'#root',
            data:{
                name:'xiba',
                mood:'happy',
                classArr:['happy','sad','normal'],
                classObj:{
                    happy:false,
                    normal:true

                },
                styleObj:{
                    color:'red',
                    fontSize:'40px'
                }
            },
            methods: {
                changeMood(){
                    const arr = ['happy','sad','normal']
                    const index = Math.floor(Math.random()*3)
                    this.mood = arr[index]
                }
            }

                
            
        })
    </script>
</body>
</html>